//
//  LGOrderDetailPatientCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2025/2/26.
//

#import "LGOrderDetailPatientCell.h"

@interface LGOrderDetailPatientCell()
/**   */
@property (nonatomic , strong)UIView *backView;
/**   */
@property (nonatomic , strong)UILabel *nameLabel;
/**   */
@property (nonatomic , strong)UILabel *phoneLabel;
/**   */
@property (nonatomic , strong)UILabel *addressLabel;

@end

@implementation LGOrderDetailPatientCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return  self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    [super setDataDic:dataDic];
    self.nameLabel.text = LGNSString(dataDic[@"realname"]);
    self.phoneLabel.text = [NSString stringWithFormat:@"%@  %@",dataDic[@"mobile"],dataDic[@"disease_name"]];
    self.addressLabel.text = [NSString stringWithFormat:@"%@（%@）",dataDic[@"level_name"],dataDic[@"level_bz"]];
}

#pragma mark
#pragma mark ====> 创建控件
-(void)createSubView{
    self.type = LGPositionTypeMiddle;
    [self.contentView addSubview:self.backView];
    [self.backView addSubview:self.nameLabel];
    [self.backView addSubview:self.phoneLabel];
    [self.backView addSubview:self.addressLabel];
    [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(-2);
        make.bottom.equalTo(self.contentView).offset(2);
        make.left.equalTo(self.contentView).offset(viewPix(28));
        make.right.equalTo(self.contentView).offset(-viewPix(28));
    }];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.backView).offset(viewPix(12));
        make.top.equalTo(self.backView).offset(viewPix(10));
    }];
    
    [self.phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.nameLabel.mas_right).offset(viewPix(8));
        make.centerY.equalTo(self.nameLabel);
    }];
    
    [self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameLabel.mas_bottom).offset(viewPix(10));
        make.left.equalTo(self.backView).offset(viewPix(12));
        make.right.bottom.equalTo(self.backView).offset(-viewPix(12));
    }];
    
}

-(UIView *)backView{
    if(!_backView){
        _backView = [[UIView alloc]init];
        _backView.backgroundColor = [UIColor colorWithString:@"#F7F9FB"];
        _backView.cornerRidus = 5;
    }
    return _backView;
}

-(UILabel *)nameLabel{
    if(!_nameLabel){
        _nameLabel = [UILabel lableWithText:@"" colorString:@"#282828" textFont:LGFontWeight(14, UIFontWeightMedium) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _nameLabel;
}

-(UILabel *)phoneLabel{
    if(!_phoneLabel){
        _phoneLabel = [UILabel lableWithText:@"" colorString:@"#606266" textFont:LGFont(13) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _phoneLabel;
}

-(UILabel *)addressLabel{
    if(!_addressLabel){
        _addressLabel = [UILabel lableWithText:@"" colorString:@"#282828" textFont:LGFont(14) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _addressLabel;
}

@end
